<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>角色管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
</head>

<body>
  <div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
    <fieldset class="layui-elem-field" style="margin-left:25px">
      <legend>角色基本信息</legend>
      <div class="layui-field-box">
        <div class="layui-form-item" >
          <input type="hidden" name="urid" value="">
          <div class="layui-form-item">
            <label class="layui-form-label">角色名称</label>
            <div class="layui-input-block">
              <input type='text' name='roleName' lay-verify="required" placeholder="请输入名称" class="layui-input" value="">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">角色code</label>
            <div class="layui-input-block">
              <input type='text' name='roleCode' lay-verify="required" placeholder="请输入code" class="layui-input"
                value="">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">角色描述</label>
            <div class="layui-input-block">
              <input type='text' name='roleDescribe' placeholder="请输入描述" class="layui-input" value="">
            </div>
          </div>
        </div>
      </div>
    </fieldset>

    <div class="layui-form-item layui-hide">
      <button class="layui-btn" lay-submit lay-filter="user-role-submit" id="user-role-submit">提交</button>
    </div>
  </div>

  <script src="../../../layuiadmin/layui/layui.js"></script>
  <script>
    layui.config({
      base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
      index: 'lib/index' //主入口模块
      , my_send: '../myModules/my_send'
    }).use(['index', 'form', 'my_send'], function () {
      var $ = layui.$
        , form = layui.form
        , my_send = layui.my_send
        , urid = '';

      var params = location.search;

      if (params && params !== '') {
        if (params.indexOf('=')) {
          urid = params.substr(params.indexOf('=') + 1);
        }

        my_send({
          url: '/role/getRoleByUrid'
          , data: { 
            'urid': urid
            , type: 'post' 
          }
          , success: function (obj) {
            obj.rows[0];
            $('#layuiadmin-form-role input').eq(0).val(obj.rows[0].urid);
            $('#layuiadmin-form-role input').eq(1).val(obj.rows[0].roleName);
            $('#layuiadmin-form-role input').eq(2).val(obj.rows[0].roleCode);
            $('#layuiadmin-form-role input').eq(3).val(obj.rows[0].roleDescribe);
          }
        })
      }
    })
  </script>
</body>

</html>